home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / SYS / s / OpenSE.rexx < prev    next >
OS/2 REXX Batch file  |  1996-09-26  |  2KB  |  52 lines

  1. /* Open file from Arguments */
  2. /* this is an example of how to modify 'Parse.rexx' 
  3.     to perform a more useful task, it will open files to the SAS/C editor.
  4.     I call this from an ARexx Program Control. The Program Control has the
  5.     following items checked.
  6.     
  7.     Skip selected directories
  8.     Work without selected items
  9.     Skip .info files
  10.     Combine all selected on one line
  11.     Workbench screen to front at start
  12.     
  13. */
  14.  
  15. IF ~SHOW("L","rexxsupport.library") THEN CALL ADDLIB"rexxsupport.library",0,-30
  16. OPTIONS RESULTS
  17.  
  18. /******************************************************************/
  19. /* set specific for the program that we will use this script with */
  20. /******************************************************************/
  21. open_command = 'OW'
  22. port_name = 'SC_SE'
  23. program_name = '"SC:C/SE"'
  24.  
  25. arguments =  ARG(1)
  26. /* if no arguments were sent test for the port and if it is 
  27.     not available run the program without an argument */
  28. if arguments = "" then do
  29.     if ~show("P",port_name) then do
  30.         ADDRESS COMMAND 'run ' || program_name
  31.         END
  32.     EXIT
  33.     END
  34. DO WHILE arguments ~= ""
  35.     /* test for quote at first of name */
  36.     /* if it starts with a Quote it ends with a Quote */
  37.     delim = " " /* default to space as a delimiter */
  38.     IF LEFT(arguments,1) = '"' THEN delim = '"'
  39.     ELSE  arguments = " " || arguments /* add space to front */
  40.     PARSE VAR arguments (delim) filename (delim) arguments
  41.     filename = STRIP(filename)
  42.     arguments = STRIP(arguments,L)
  43.     if ~show("P",port_name) then do
  44.         ADDRESS COMMAND 'run ' || program_name || ' ' || filename
  45.         ADDRESS COMMAND 'WaitForPort ' || port_name
  46.         END
  47.     else do
  48.         ADDRESS (port_name)
  49.         open_command filename || d2c(13) /* return character require for SE */
  50.         END
  51. END
  52.